package com.spring.reactive.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

import java.util.HashMap;

@RequestMapping("user")
@RestController
public class UserController {


    @GetMapping
    public Mono<HashMap<String, Object>> getUserInfo(){

        return Mono.fromCallable(()->{
            HashMap<String, Object> result = new HashMap<>();

            result.put("code", 200);
            result.put("msg", "success");

            HashMap<String, Object> user = new HashMap<>();

            user.put("name", "jack");
            user.put("age", 20);
            user.put("address", "北京市朝阳区望京SOHO");
            result.put("data", user);
            return result;
        });
    }

}
